//
//  UITextView+HBTextLength.h
//  HBLibary
//
//  Created by Rambo on 2018/6/8.
//

#import <UIKit/UIKit.h>

typedef void(^UITextViewTextLengthChangeBlock)(NSUInteger textLength, NSUInteger maxLength);

@interface UITextView (HBTextLength)

#pragma mark - ***maxLength

@property (nonatomic, assign) NSUInteger hb_maxLength; ///< 文本最大长度（当大于0时，则自动截取最大长度文本）

@property (nonatomic, copy) UITextViewTextLengthChangeBlock hb_textLengthChange;  ///< 文本长度改变回调

@property (nonatomic, assign) BOOL hb_autoInterceptMaxLength;  ///< 自动截取最大长度，默认NO


#pragma mark - ***placeholder

@property (nonatomic, copy) NSString *hb_placeholder;  ///< 占位符

@property (nonatomic, strong) UIColor *hb_placeholderColor;    ///< 占位符颜色，默认 darkGrayColor alpha0.5

#pragma mark - ***textCount

@property (nonatomic, assign) BOOL showTextCount;   ///< 是否显示文本个数（currentCount/MaxLengthCount）,默认 NO

@property (nonatomic, strong) UIColor *textCountDefaultColor;   ///< 文本个数未超过最大长度时颜色，默认 darkGrayColor alpha0.5

@property (nonatomic, strong) UIColor *textCountFullColor;  ///< 文本个数超过最大长度时颜色，默认 redColor

@property (nonatomic, strong) UIFont *textCountFont;    ///< 文本个数字体，默认 12

@property (nonatomic, assign) CGFloat textCountRightMargin; ///< 文本个数右边间距，默认 0

@property (nonatomic, assign) CGFloat textCountBottomMargin;    ///< 文本个数下面间距，默认 0

@property (nonatomic, assign, readonly) NSUInteger currentTextCount;    ///< 当前文本长度

- (void)hb_showEndEditToolView;
@end

